import { createApp } from 'vue'
import { createPinia } from 'pinia'
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'   // pinia持久化插件

import App from './App.vue'
import router from './router'
import './style.css'
import 'element-plus/dist/index.css'
import './assets/css/index.scss'
import ElementPlus from 'element-plus'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import dayjs from'dayjs';
import 'dayjs/locale/zh-cn'; 
dayjs.locale('zh-cn');          // 日历中用中文

import AppLink from '@/components/AppLink/index.vue'
import AppIcon from '@/components/AppIcon/index.vue'

import './permission.js'

const pinia = createPinia()
pinia.use(piniaPluginPersistedstate)   //将pina就持久化

const app = createApp(App)

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}

app.component('app-link', AppLink)   // 设置全局组件
app.component('app-icon', AppIcon)   // 设置全局组件
app.use(router)
app.use(pinia)
app.use(ElementPlus)

app.mount('#app')
